package com.niuwa.p2p.dao.redenvelope;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import com.niuwa.p2p.dao.MyBatisDao;
import com.niuwa.p2p.entity.redenvelope.RedRange;

@MyBatisDao
public interface RedRangeDao {
    int deleteByPrimaryKey(Long id);

    /**
     * 添加区间
     * @param list
     * @return
     */
    int insertbatch(List<RedRange> list);
    
    /**
     * 根据规则编号查询所有金额区间值
     * @param ruleNo
     * @return
     */
    List<RedRange> selectRedRangeByRuleNo(String ruleNo);
    
    /**
     * 根据规则编号删除所有相关金额区间值
     * @param ruleNo
     * @return
     */
    int deleteRedRangeByRuleNo(String ruleNo);

    RedRange selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(RedRange record);

    int updateByPrimaryKey(RedRange record);
    
    /**
     * 根据投资规则和投资金额获取红包金额
     * @param map
     * @return
     */
    BigDecimal getAmountByInvestAmount(Map<String,Object> map);
}